package cn.easy.mortgage.repository;

import cn.easy.mortgage.domain.Channel;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;

public interface ChannelDao extends PagingAndSortingRepository<Channel, String>, JpaSpecificationExecutor<Channel> {

    Channel findByCode(String code);

    Channel findByUserId(String userId);

    List<Channel> findByType(int type);

    List<Channel> findByPid(String pid);

    List<Channel> findByNoStartingWith(String no);

    @Query("FROM Channel WHERE no like ?1 order by createdAt")
    public List<Channel> findByNo(String no);
}
